package com.example.demosecurity.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @GetMapping("/test")
    public String test() {
        return "test";
    }

    @PostMapping("/doLogin")
    public String login() {
        System.out.println("doLogin");
        return "test";
    }

    @GetMapping("/test2")
    public String test2(Authentication authentication) {
        System.out.println(authentication.getPrincipal());
        return "test2";
    }

}
